package refactoring_guru.simple_factory;

/**
 * @date 2024/9/8
 * desc
 */
public class SimpleFactory {


    public static final Door getDoor(int type) {
        switch (type) {
            case 1:
                return new WoodDoor();
            case 2:
                return new IronDoor();

            default:
                return new WoodDoor();
        }

    }


}

interface Door {

    String desc();

}

class WoodDoor implements Door {


    @Override
    public String desc() {
        return "wood door";
    }
}

class IronDoor implements Door {


    @Override
    public String desc() {
        return "iron door";
    }
}
